<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <title>用户管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 导入公共样式及js -->


    <jsp:include page="../commons/css.jsp"></jsp:include>


</head>

<body>
<!-- 头部 -->

<jsp:include page="../commons/head.jsp"></jsp:include>

<div class="content">
    <!-- 菜单 -->

    <jsp:include page="../commons/left.jsp"></jsp:include>


    <div class="mainbar">
        <div class="page-head">
            <h2 class="pull-left"><i class="icon-home"></i> 首页</h2>
            <div class="bread-crumb pull-right">
                <a href="index.html"><i class="icon-home"></i> 首页</a>
                <!-- Divider -->
                <span class="divider">/</span>
                <a href="#" class="bread-current">用户管理</a>
            </div>
            <div class="clearfix"></div>
        </div>

        <!-- 内容主体 -->
        <div class="matter">
            <div class="container">

                <!-- 搜索框 -->
                <div class="row">
                    <div class="col-md-8">
                        <div class="widget">
                            <div class="widget-head">
                                <div class="pull-left">快速搜索</div>
                                <div class="clearfix"></div>
                            </div>
                            <div class="widget-content">
                                <div class="padd">
                                    <div class="form quick-post">
                                        <!-- Edit profile form (not working)-->
                                        <form class="form-horizontal" method="post" action="admin/user/list">
                                            <div class="form-group">
                                                <div class="col-lg-8 col-md-6 col-sm-10 col-xs-8"
                                                     style="margin-bottom: 10px;">
                                                    <input name="retrieval" type="text" class="form-control" id="title"
                                                           placeholder="用户名搜索" value="">
                                                </div>
                                                <div class="col-lg-2 col-md-3 col-sm-10 col-xs-8">
                                                    <select name="type" class="form-control">


                                                        <option selected="selected" value="0">全部</option>
                                                        <option value="1">学生</option>
                                                        <option value="2">老师</option>
                                                        <option value="3">社团</option>
                                                        <option value="4">学院</option>


                                                    </select>
                                                </div>
                                                <div class="col-lg-1 col-md-3 col-sm-2 col-xs-4">
                                                    <button type="submit" class="btn btn-success">搜索</button>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>


                <div class="row">
                    <div class="col-md-12">
                        <div class="widget">
                            <div class="widget-head">
                                <div class="pull-left"></div>
                                <a style="right:" class="btn btn-active" href="insertNewsList">增加</a>
                                <div class="clearfix"></div>
                            </div>

                            <div class="widget-content">

                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>标题</th>
                                        <th>记者</th>
                                        <th>发布时间</th>
                                        <th>修改时间</th>
                                        <th>新闻内容</th>
                                        <th>新闻关键字</th>
                                        <th>新闻类别</th>
                                        <th colspan="2">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>


                                    <c:forEach items="${news}" var="news">
                                        <tr>
                                            <td>${news.id}</td>
                                            <td>${news.title }</td>
                                            <td>${news.reporter }</td>
                                            <td><fmt:formatDate type="date" value="${news.release_time }"/></td>
                                            <td><fmt:formatDate type="date" value="${news.update_time }"/></td>
                                            <td>${news.content }</td>
                                            <td>${news.key_words }</td>
                                            <td>${news.category_name }</td>
                                            <td>
                                                <a class="btn btn-active" href="deleteNews?id=${news.id }">删除</a>
                                            </td>
                                            <td>
                                                <a class="btn btn-active" href="updateNewsList?id=${news.id }">修改</a>
                                            </td>
                                        </tr>
                                    </c:forEach>


                                    </tbody>
                                </table>

                                <div class="widget-foot">


                                    <!-- 使用此分页需要两个属性space.admin.vo.Page page 和 url  -->
                                    <style>
                                        .pagination li {
                                            width: 25px;
                                            clear: both;
                                        }
                                    </style>
                                    <ul class="pagination ">


                                        <!-- jstl+a（href）实现的分页--》网页全部刷新 -->


                                        <li>
                                            <a href="<%=request.getContextPath() %>/admin/userlist?currentpage=1&pagesize=5"
                                               aria-label="Previous" class="btn btn-active">
                                                首页
                                            </a>
                                        </li>
                                        <c:if test="${page.hasPreviousPage }">
                                            <li>
                                                <a href="<%=request.getContextPath() %>/admin/userlist?currentpage=${page.prePage }&pagesize=5"
                                                   aria-label="Previous" class="btn btn-active">
                                                    上一页
                                                </a>
                                            </li>
                                        </c:if>
                                        <c:forEach begin="1" end="${page.pages }" var="i">
                                            <li><a class="btn btn-active"
                                                   href="<%=request.getContextPath() %>/admin/userlist?currentpage=${i }&pagesize=5">${i }</a>
                                            </li>
                                        </c:forEach>
                                        <c:if test="${page.hasNextPage }">
                                            <li>
                                                <a href="<%=request.getContextPath() %>/admin/userlist?currentpage=${page.nextPage }&pagesize=5"
                                                   aria-label="Next" class="btn btn-active">
                                                    下一页
                                                </a>
                                            </li>
                                        </c:if>
                                        <li>
                                            <a href="<%=request.getContextPath() %>/admin/userlist?currentpage=${page.pages }&pagesize=5"
                                               aria-label="Previous" class="btn btn-active">
                                                尾页
                                            </a>
                                        </li>


                                    </ul>
                                    <div class="clearfix"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Matter ends -->
    </div>

    <!-- Mainbar ends -->
    <div class="clearfix"></div>

</div>
<!-- Content ends -->

<!-- Footer starts -->

<jsp:include page="../commons/foot.jsp"></jsp:include>
<!-- 快速回到顶部 -->
<span class="totop"><a href="#"><i class="icon-chevron-up"></i></a></span>
<!-- Footer ends -->

</body>

</html>